//
//  YSReaderSetting.h
//  YSBookRead
//
//  Created by Kyson on 2018/11/6.
//  Copyright © 2018 YangShen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define kYSReaderXSpace 20.0
#define kYSReaderYSpace 40.0

static inline CGRect YSReaderFrame() {
    static CGRect readerFrame;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        readerFrame = CGRectMake(kYSReaderXSpace, kYSReaderYSpace, [[UIScreen mainScreen] bounds].size.width - 2 * kYSReaderXSpace, [[UIScreen mainScreen] bounds].size.height - 2 * kYSReaderYSpace);
    });
    return readerFrame;
}

#define kYSFontSizeMax 25
#define kYSFontSizeMin 13

#define kYSLineSpacingMax 15
#define kYSLineSpacingMin 1

#define kYSReaderLeftSpace 20.0
#define kYSReaderRightSpace 20.0
#define kYSReaderTopSpace 40.0
#define kYSReaderBottomSpace 40.0

typedef NS_ENUM(NSInteger,YSReaderTheme) {
    YSReaderThemeOne = 0,
    YSReaderThemeTwo,
    YSReaderThemeThree,
    YSReaderThemeFour,
    YSReaderThemeFive,
    YSReaderThemeSix,
    YSReaderThemeSeven,
    YSReaderThemeEight,
    YSReaderThemeNine,
    YSReaderThemeTen
};

typedef NS_ENUM(NSInteger,YSTurnPageStyle) {
    /// 仿真
    YSTurnPageStylePageCurl = 0,
    /// 平滑
    YSTurnPageStyleScroll,
    /// 上下滚动
    YSTurnPageStyleUpAndDown,
    /// 无效果
    YSTurnPageStyleNone,
};

@interface YSReaderSetting : NSObject <NSCoding>

+ (instancetype)shareReaderSettings;

/// 亮度
@property (nonatomic, assign) CGFloat brightness;
/// 行间距
@property (nonatomic, assign) CGFloat lineSpacing;
/// 主题
@property (nonatomic, assign) YSReaderTheme theme;
/// 翻页方式
@property (nonatomic, assign) YSTurnPageStyle pageStyle;
/// 是否夜间模式
@property (nonatomic, assign) BOOL isNightMode;
/// 字体大小
@property (nonatomic, assign) CGFloat fontSize;

@property (nonatomic, copy) void(^updateSettingBlock)(void);

/// 字体大小
@property (nonatomic, strong, readonly) UIFont *font;
/// 字体颜色
@property (nonatomic, strong, readonly) UIColor *textColor;
/// 其他如标题,电池,时间等字体颜色
@property (nonatomic, strong, readonly) UIColor *otherTextColor;
/// 主题图片
@property (nonatomic, strong, readonly) UIImage *themeImage;
/// 主题图片数组
@property (nonatomic, strong, readonly) NSArray *themeImageArr;
/// 阅读页面文字属性
@property (nonatomic, strong, readonly) NSDictionary *readerAttributes;

@end

